package com.sgd.other.引号引用_逗号分隔;

import java.io.*;

/**
 * <p>Title: 引号引用_逗号分隔</p>
 * <p>Description: 将需要处理的字符串内容添加到「引号引用_逗号分隔.txt」文档中；然后执行 main 方法即可。</p>
 *
 * @author su.gd
 * @date 2023-11-17
 */
public class 引号引用_逗号分隔 {
    public static void main(String[] args) {

        quoteCommaProcessing();
    }

    public static void quoteCommaProcessing() {
        FileReader fileReader = null;
        BufferedReader bufferedReader = null;
        // 输出结果
        String result = "";
        // 输入文件路径
        String projectPath = System.getProperty("user.dir");
        String inputPath = projectPath + File.separator + "code-generator-basic/src/main/java/com/sgd/other/引号引用_逗号分隔/引号引用_逗号分隔.txt";
        try {
            fileReader = new FileReader(inputPath);
            bufferedReader = new BufferedReader(fileReader);
            String line = bufferedReader.readLine();
            while (line != null) {
                result += "'" + line + "', ";
                line = bufferedReader.readLine();
            }
            int lastIndex = result.lastIndexOf(", ");
            result = result.substring(0, lastIndex);
            System.out.println(result);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            try {
                bufferedReader.close();
                fileReader.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }
}

